Skip to content

hexagon: extend scalar DMA broadcasting support for binary ops - #30245

Merged
max-krasnyansky merged 9 commits into
ggml-org:masterfrom
qualcomm:kurquhar/hexagon-extended-scalar-dma-external
Oct 13, 2026
Merged

max-krasnyansky merged 9 commits into
ggml-org:masterfrom
qualcomm:kurquhar/hexagon-extended-scalar-dma-external

Conversation

@kurquhar

@kurquhar kurquhar commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Extend scalar DMA broadcasting support on hexagon backend

Additional information

Hexagon does not currently support this op condition, but it is needed by stable-diffusion.cpp. There will be a future companion PR for the corresponding backend ops test support.

Specifically, FastWan has the following geometry for ADD:
src1 = [1,1,1,C] as bias WEIGHTS
src0 = [W,H,T,C]

Before this change:

  • the existing scalar DMA kernel was not selected during graph processing (ne13!=1)
  • the scalar kernel was selected instead (ne10==1)
  • execute_op_binary() returns HTP_STATUS_NO_SUPPORT at runtime when it encounters an extended DMA tensor coupled with the scalar kernel

After this change:

  • the extended scalar DMA kernel now also supports non-unity higher dimensions e.g. ne13==ne03
  • the extended scalar DMA kernel is selected via an additional gate (ne10==1 && dma64 && WEIGHTS && contig && fits)

Verification:

  • Targeted weighted scalar ADD/MUL HTP regression passes.
  • Broad HTP ADD,SUB,MUL,DIV sweep passed: 287/287 supported cases.

Requirements

  • I have read and agree with the contributing guidelines yes
  • AI usage disclosure: Yes: to reason, code the kernel extension, and perform A/B testing.

Assisted-by: OpenCode

@github-actions github-actions Bot added ggml changes relating to the ggml tensor library for machine learning Hexagon labels Oct 9, 2026
@kurquhar
kurquhar marked this pull request as ready for review October 9, 2026 18:16
@kurquhar
kurquhar requested a review from a team as a code owner October 9, 2026 18:16
@max-krasnyansky

Copy link
Copy Markdown
Member

Closing for a sec to undraft another PR

@kurquhar
kurquhar force-pushed the kurquhar/hexagon-extended-scalar-dma-external branch from 3eda01b to 85ff470 Compare October 13, 2026 01:18
@kurquhar
kurquhar requested a review from ggerganov as a code owner October 13, 2026 01:18
@github-actions github-actions Bot added the testing Everything test related label Oct 13, 2026
@max-krasnyansky
max-krasnyansky force-pushed the kurquhar/hexagon-extended-scalar-dma-external branch from 85ff470 to d86c81d Compare October 13, 2026 03:05
@max-krasnyansky

Copy link
Copy Markdown
Member

@lhez for another review and ack

@max-krasnyansky

Copy link
Copy Markdown
Member

@ggerganov @CISC we added a couple more tests here for binary ops that were not covered and cause issues in ggml-hexagon.
The CI runs look clean for all backends. I'm going to merge. Let me know if you want a follow up on the tests.

@max-krasnyansky
max-krasnyansky merged commit 4413a19 into ggml-org:master Oct 13, 2026
23 checks passed
@BrewTestBot BrewTestBot mentioned this pull request Oct 15, 2026
1 task done
edwardyoon pushed a commit to edwardyoon/focus-llama that referenced this pull request Oct 24, 2026
…org#30245)

* tests: cover weighted scalar broadcasts

Assisted-by: OpenCode

* ggml : support extended scalar DMA binary ops

Assisted-by: OpenCode

* hex-binary: remove all non-dma paths

* hex-binary: add support for non-contig strides and cleanup dma preable a bit

* hex-binary: cleanup the gating and simplify dma retry

* hex-geglu-erf: add a gate for F32 only, we dont support F16 for this op

* tests: cover weighted repeat broadcast

Assisted-by: OpenCode

* hex-binary: update REPEAT and COMPLEX kernels to use dma as well (missed them last time)

* hex-add-id: add dma support for src2 (idx)

---------

Co-authored-by: Max Krasnyansky <maxk@qti.qualcomm.com>
auRose94 pushed a commit to auRose94/llama.cpp that referenced this pull request Oct 28, 2026
…org#30245)

* tests: cover weighted scalar broadcasts

Assisted-by: OpenCode

* ggml : support extended scalar DMA binary ops

Assisted-by: OpenCode

* hex-binary: remove all non-dma paths

* hex-binary: add support for non-contig strides and cleanup dma preable a bit

* hex-binary: cleanup the gating and simplify dma retry

* hex-geglu-erf: add a gate for F32 only, we dont support F16 for this op

* tests: cover weighted repeat broadcast

Assisted-by: OpenCode

* hex-binary: update REPEAT and COMPLEX kernels to use dma as well (missed them last time)

* hex-add-id: add dma support for src2 (idx)

---------

Co-authored-by: Max Krasnyansky <maxk@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning Hexagon testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants